// my-fresh-blog/components/Head.tsx
import { ComponentChildren } from "preact";
import { asset } from "$fresh/runtime.ts";

type Props = {
  title?: string;
  description?: string;
  image?: string;
  children?: ComponentChildren;
};

export default function HeadComponent({ 
  title, 
  description = "一个简约而优雅的个人博客", 
  image = "/images/og-image.jpg", 
  children 
}: Props) {
  const siteName = "Mono";
  const fullTitle = title ? `${title} | ${siteName}` : siteName;

  return (
    <head>
      <meta charSet="utf-8" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      <title>{fullTitle}</title>
      <meta name="description" content={description} />
      
      {/* Open Graph Meta Tags */}
      <meta property="og:title" content={fullTitle} />
      <meta property="og:description" content={description} />
      <meta property="og:image" content={image} />
      <meta property="og:type" content="website" />
      
      {/* Favicons */}
      <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
      <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
      <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
      
      {/* Google Fonts - Inter */}
      <link rel="preconnect" href="https://fonts.googleapis.com" />
      <link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
      <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=IBM+Plex+Mono&display=swap" rel="stylesheet" />
      
      {/* Custom styles */}
      <link rel="stylesheet" href={asset("/styles.css")} />
      
      {children}
    </head>
  );
}